package yhao.demo.web.firstWeb.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import yhao.infra.web.interceptor.ZBaseInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SwaggerLoginInterceptor extends ZBaseInterceptorAdapter {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public boolean preHandle(HttpServletRequest request,
                             HttpServletResponse response, Object handler) throws Exception {
        String referer = request.getHeader("Referer");
        if (referer != null && referer.contains("192.168.0.131")) {
            try {
                //此处做登录处理
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        return super.preHandle(request, response, handler);
    }
}
